using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableUnionConfigDao:DaoBase<TableUnionConfig>
    {
        public override void AddPrimaryIndex(TableUnionConfig model)
        {
            cachePrimary[model.Level.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableUnionConfig.txt";
        }

        protected override TableUnionConfig ParseRowData(string[] rowData)
        {
            TableUnionConfig data = new TableUnionConfig();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.Level = 0;
            }
            else
            {
                data.Level = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.MaxMemberNum = 0;
            }
            else
            {
                data.MaxMemberNum = int.Parse(rowData[1]);
            }

            if (string.IsNullOrEmpty(rowData[2]))
            {
                data.ActiveScore = 0;
            }
            else
            {
                data.ActiveScore = int.Parse(rowData[2]);
            }
			data.CommonReward = rowData [3];
			data.ViceReward = rowData [4];
			data.ChairmanReward = rowData [5];

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.UnionExpScore = 0;
            }
            else
            {
                data.UnionExpScore = int.Parse(rowData[6]);
            }

            if (string.IsNullOrEmpty(rowData[7]))
            {
                data.UnionBadge = 0;
            }
            else
            {
                data.UnionBadge = int.Parse(rowData[7]);
            }

            if (string.IsNullOrEmpty(rowData[8]))
            {
                data.UnionCoin = 0;
            }
            else
            {
                data.UnionCoin = int.Parse(rowData[8]);
            }

            return data;
        }



    }

}
